package com.mojo.mybatis.service;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.mojo.mybatis.dao.BackstageRoleDao;
import com.mojo.mybatis.dao.BackstageUserDao;
import com.mojo.mybatis.pojo.BackstageUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author <a href="mailto:sjj@jianzhimao.com">mojo</a>
 * copyright (C), 2013-2022, 广州九尾信息科技有限公司
 * @date 2022/3/14 15:37
 */
@Service
public class UserService {
    @Autowired
    private BackstageUserDao userDao;
    @Autowired
    private BackstageRoleDao backstageRoleDao;

    public BackstageUser getUser(Integer id) {
        userDao.select(id);
        backstageRoleDao.select(id);
        return userDao.select(id);
    }

    public List<BackstageUser> pageUser(Integer p) {
        PageHelper.startPage(p, 1);
        return userDao.page();
    }
}
